package a.h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.AffineTransform;
import java.beans.PropertyVetoException;
import java.net.URL;

class e
  extends d
  implements id.b_
{
  private JToggleButton n;
  private dd o;
  private Color p;
  private boolean q;
  private boolean r;
  private ob s;
  private String t;
  private static final int u = 32;
  private static final int v = 32;
  private int w = 4;
  
  public e(lc paramlc, ob paramob)
  {
    super(paramlc);
    a(paramlc, paramob);
  }
  
  private void a(lc paramlc, ob paramob)
  {
    int i = ec.t;
    boolean bool = ec.s;
    this.s = paramob;
    if (i == 0) {
      if (this.s == null)
      {
        if (i != 0) {
          break label62;
        }
        this.t = "No Graphics";
        if (!bool) {
          break label58;
        }
      }
    }
    this.t = this.s.b("IMAGE_OPTION_ITEM.NO_IMAGE");
    label58:
    label62:
    Object localObject = paramlc.o();
    Icon localIcon = null;
    String str = null;
    if ((localObject != null) && ((i != 0) || (!paramlc.r())))
    {
      if (i == 0) {
        if ((localObject instanceof dd))
        {
          localIcon = ((dd)localObject).a();
          URL localURL = ((dd)localObject).b();
          if ((i != 0) || (localURL != null))
          {
            str = localURL.toString();
            break label194;
          }
          str = "";
          break label194;
        }
      }
      if (i == 0) {
        if ((localObject instanceof Icon))
        {
          localIcon = (Icon)localObject;
          break label194;
        }
      }
      if ((localObject instanceof URL))
      {
        localIcon = paramlc.b().b((URL)localObject).a();
        str = localObject.toString();
      }
    }
    label194:
    if (localIcon != null)
    {
      this.n = new JToggleButton(localIcon);
      if (i != 0) {
        break label253;
      }
      if (str != null)
      {
        if (i != 0) {
          break label253;
        }
        this.n.setText(str);
        if (!bool) {}
      }
    }
    else
    {
      this.n = new JToggleButton();
    }
    if (localObject != null) {
      label253:
      if (!paramlc.r()) {}
    } else {
      this.n.setText(this.t);
    }
    this.n.setMinimumSize(new Dimension(36, 32));
    this.n.setPreferredSize(new Dimension(36, 32));
    this.n.setHorizontalAlignment(10);
    this.n.setMargin(new Insets(this.w, 3 * this.w, this.w, 3 * this.w));
    this.p = this.n.getBackground();
    this.n.addActionListener(new ActionListener()
    {
      private final lc val$item;
      
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        e.this.a(this.val$item);
      }
    });
    this.r = false;
    a(localObject);
    this.r = true;
    this.q = false;
    d(this.i.m());
    c(this.i.f());
  }
  
  private Icon a(Icon paramIcon)
  {
    double d1 = paramIcon.getIconWidth();
    int i = paramIcon.getIconHeight();
    double d2 = d1 / i;
    int j = 32 - 2 * this.w;
    d1 = j * d2;
    return new b_(paramIcon, d1 / paramIcon.getIconWidth());
  }
  
  private void a(lc paramlc)
  {
    int j = ec.t;
    int i = paramlc.b().a().size();
    id localid = new id(paramlc, this.n, new Rectangle(this.n.getWidth(), this.n.getHeight()), this.s);
    localid.a(this);
    if (j == 0) {
      if (i > 0)
      {
        JPopupMenu localJPopupMenu = localid.a();
        localJPopupMenu.setSize(this.n.getWidth(), localJPopupMenu.getHeight());
        localJPopupMenu.show(this.n, 0, this.n.getHeight());
      }
    }
    if ((j != 0) || ((ec.s) && (((Boolean)paramlc.c("IconOptionItem.ALLOW_BROWSE")).booleanValue()))) {
      localid.a(null);
    }
  }
  
  public Object n()
  {
    return this.o;
  }
  
  public void a(Object paramObject)
  {
    int i = ec.t;
    boolean bool = ec.s;
    if (i == 0) {
      if (paramObject == null)
      {
        b();
        if ((i == 0) && (!bool)) {
          return;
        }
      }
    }
    if (i == 0) {
      if ((paramObject instanceof dd))
      {
        a((dd)paramObject);
        if ((i == 0) && (!bool)) {
          return;
        }
      }
    }
    if (i == 0) {
      if ((paramObject instanceof URL)) {
        a(((lc)this.i).b().b((URL)paramObject));
      }
    }
    if ((i != 0) || ((bool) && ((paramObject instanceof Icon)))) {
      a(new dd((Icon)paramObject, null));
    }
  }
  
  public boolean o()
  {
    return this.n.isEnabled();
  }
  
  public void c(boolean paramBoolean)
  {
    boolean bool = this.n.isEnabled();
    if (ec.t == 0)
    {
      if (bool != paramBoolean) {
        this.n.setEnabled(paramBoolean);
      }
    }
    else {
      a(bool, paramBoolean);
    }
  }
  
  public boolean p()
  {
    return this.q;
  }
  
  public void d(boolean paramBoolean)
  {
    int i = ec.t;
    if ((i != 0) || (this.q != paramBoolean))
    {
      boolean bool = this.q;
      if (i == 0)
      {
        this.q = paramBoolean;
        if (paramBoolean)
        {
          this.n.setText("");
          this.n.setIcon(null);
          if (i != 0) {
            break label83;
          }
          this.n.setBackground(ic.a);
          if (!ec.s) {
            break label82;
          }
        }
      }
      this.n.setBackground(this.p);
      label82:
      label83:
      b(bool, paramBoolean);
    }
  }
  
  public JComponent f()
  {
    return this.n;
  }
  
  void a(dd paramdd)
  {
    int i = ec.t;
    boolean bool = ec.s;
    dd localdd = this.o;
    String str = this.n.getText();
    if ((i != 0) || (nb.a(localdd, paramdd)))
    {
      if (i == 0)
      {
        if (this.r) {
          try
          {
            b(e, localdd, paramdd);
          }
          catch (PropertyVetoException localPropertyVetoException)
          {
            this.n.setIcon(a(localdd.a()));
            this.n.setText(str);
            return;
          }
        }
        if (i != 0) {}
      }
      else
      {
        if (paramdd.c())
        {
          this.o = paramdd;
          this.n.setIcon(null);
          this.n.setText(this.t);
          if (i != 0) {
            break label221;
          }
          if (!bool) {
            break label212;
          }
        }
        this.o = paramdd;
      }
      Icon localIcon = paramdd.a();
      this.n.setIcon(localIcon == null ? null : a(localIcon));
      URL localURL = paramdd.b();
      if (i == 0)
      {
        if (localURL != null) {
          this.n.setText(localURL.toString());
        }
      }
      else
      {
        if (i != 0) {
          break label221;
        }
        if (!bool) {
          break label212;
        }
      }
      this.n.setText("");
      label212:
      if ((i != 0) || (this.r)) {
        label221:
        a(localdd, paramdd);
      }
    }
  }
  
  void b()
  {
    int i = ec.t;
    dd localdd = this.o;
    String str = this.n.getText();
    if ((i != 0) || (nb.a(localdd, null)))
    {
      if (i == 0)
      {
        if (this.r) {
          try
          {
            b(e, localdd, null);
          }
          catch (PropertyVetoException localPropertyVetoException)
          {
            this.n.setIcon(a(localdd.a()));
            this.n.setText(str);
            return;
          }
        }
        this.o = null;
        this.n.setIcon(null);
        this.n.setText(this.t);
      }
      if ((i != 0) || (this.r)) {
        a(localdd, null);
      }
    }
  }
  
  void b(JPopupMenu paramJPopupMenu, Object paramObject)
  {
    a(paramObject);
    d(false);
    paramJPopupMenu.setVisible(false);
    this.n.setSelected(false);
  }
  
  public void a(JPopupMenu paramJPopupMenu, Object paramObject)
  {
    b(paramJPopupMenu, paramObject);
  }
  
  public void a()
  {
    this.n.setSelected(false);
  }
  
  static class b_
    implements Icon
  {
    Icon a;
    private double b;
    
    b_(Icon paramIcon, double paramDouble)
    {
      this.a = paramIcon;
      this.b = paramDouble;
    }
    
    public void paintIcon(Component paramComponent, Graphics paramGraphics, int paramInt1, int paramInt2)
    {
      Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
      AffineTransform localAffineTransform = localGraphics2D.getTransform();
      localGraphics2D.scale(this.b, this.b);
      this.a.paintIcon(paramComponent, paramGraphics, paramInt1, paramInt2);
      localGraphics2D.setTransform(localAffineTransform);
    }
    
    public int getIconWidth()
    {
      return (int)(this.a.getIconWidth() * this.b);
    }
    
    public int getIconHeight()
    {
      return (int)(this.a.getIconHeight() * this.b);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.h.e

 * JD-Core Version:    0.7.0.1

 */